﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Heavy_Metals
{
    public partial class FXYXX_Dan_FX : Form
    {
        public FXYXX_Dan_FX()
        {
            InitializeComponent();
        }
        public DrawCurves dc = new DrawCurves();
        private void FXYXX_Dan_FX_Load(object sender, EventArgs e)
        {
            this.dataGridView1.Columns.Add("污染指标", "污染指标");
            this.dataGridView1.Columns.Add("监测时间", "监测时间");
            this.dataGridView1.Columns.Add("监测浓度", "监测浓度");
            this.dataGridView1.Columns.Add("所属企业", "所属企业");
            this.dataGridView1.Rows.Add("砷","2011.2.4","4.5","A企业");
            this.dataGridView1.Rows.Add("镉", "2012.5.3", "5.7", "大庆化工");
        }

        private void FXYXX_Dan_FX_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            Pen p = new Pen(Color.Blue, 2);
            dc.DrawCoordinate(g, p, 500, 200, 400, 150, 20, 20, 2.5, 5.0);
        }

        private void button5_Click(object sender, EventArgs e)
        {
            Graphics g = this.CreateGraphics();
            Pen p = new Pen(Color.Blue, 2);
            MessageBox.Show("预测成功", "操作提示");
            double perPicelY = 5.0 / 20;
            double[] data = { 10, 6, 6,8,4, 4, 10, 6,7,9,6,9,8,5,6,7,6 };
            dc.DrawCurve(g, p, "砷", new Point(460, 100), 500, 200, perPicelY, 20, data);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (this.listBox1.SelectedIndex != -1)
            {
                this.listBox2.Items.Add(this.listBox1.SelectedItem.ToString());
                this.listBox1.Items.RemoveAt(this.listBox1.SelectedIndex);
            }
            
        }
        private void button2_Click(object sender, EventArgs e)
        {
            if (this.listBox2.SelectedIndex != -1)
            {
                this.listBox1.Items.Add(this.listBox2.SelectedItem.ToString());
                this.listBox2.Items.RemoveAt(this.listBox2.SelectedIndex);
            }
            
        }
        private void button3_Click(object sender, EventArgs e)
        {
            int count = this.listBox1.Items.Count;
            int i = 0;
            for (i = 0; i < count; i++)
            {
                this.listBox2.Items.Add(this.listBox1.Items[i].ToString());
            }
            this.listBox1.Items.Clear();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            int count = this.listBox2.Items.Count;
            int i = 0;
            for (i = 0; i < count; i++)
            {
                this.listBox1.Items.Add(this.listBox2.Items[i].ToString());
            }
            this.listBox2.Items.Clear();
        }


    }
}
